package com.ruoyi.project.jiaqin.companynews.service.impl;

import java.util.List;
import java.util.UUID;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.project.jiaqin.companynews.mapper.CompanyNewsMapper;
import com.ruoyi.project.jiaqin.companynews.domain.CompanyNews;
import com.ruoyi.project.jiaqin.companynews.service.ICompanyNewsService;
import com.ruoyi.common.utils.text.Convert;

/**
 * 企业新闻Service业务层处理
 *
 * @author admin
 * @date 2021-01-08
 */
@Service
public class CompanyNewsServiceImpl implements ICompanyNewsService
{
    @Autowired
    private CompanyNewsMapper companyNewsMapper;

    /**
     * 查询企业新闻
     *
     * @param id 企业新闻ID
     * @return 企业新闻
     */
    @Override
    public CompanyNews selectCompanyNewsById(String id)
    {
        return companyNewsMapper.selectCompanyNewsById(id);
    }

    /**
     * 查询企业新闻列表
     *
     * @param companyNews 企业新闻
     * @return 企业新闻
     */
    @Override
    public List<CompanyNews> selectCompanyNewsList(CompanyNews companyNews)
    {
        return companyNewsMapper.selectCompanyNewsList(companyNews);
    }

    /**
     * 新增企业新闻
     *
     * @param companyNews 企业新闻
     * @return 结果
     */
    @Override
    public int insertCompanyNews(CompanyNews companyNews)
    {
        companyNews.setId(UUID.randomUUID().toString().replace("-",""));
        return companyNewsMapper.insertCompanyNews(companyNews);
    }


    /**
     * 修改企业新闻
     *
     * @param companyNews 企业新闻
     * @return 结果
     */
    @Override
    public int updateCompanyNews(CompanyNews companyNews)
    {
        return companyNewsMapper.updateCompanyNews(companyNews);
    }

    /**
     * 删除企业新闻对象
     *
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteCompanyNewsByIds(String ids)
    {
        return companyNewsMapper.deleteCompanyNewsByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除企业新闻信息
     *
     * @param id 企业新闻ID
     * @return 结果
     */
    @Override
    public int deleteCompanyNewsById(String id)
    {
        return companyNewsMapper.deleteCompanyNewsById(id);
    }
}
